import request from '@/utils/request'

export function articleList(data) {
  return request({
    url: '/v1/find/article/by/example',
    method: 'post',
    data
  })
}

export function fetchArticle(data) {
  return request({
    url: '/v1/article/get/by/id',
    method: 'post',
    data
  })
}

export function fetchPv(pv) {
  return request({
    url: '/vue-element-admin/article/pv',
    method: 'get',
    params: { pv }
  })
}

export function addArticle(data) {
  return request({
    url: '/v1/add/article',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return request({
    url: '/v1/update/article',
    method: 'post',
    data
  })
}

export function deleteArticle(data) {
  return request({
    url: '/v1/delete/article',
    method: 'post',
    data
  })
}

export function changeState(data) {
  return request({
    url: `/v1/article/update/hidden`,
    method: 'post',
    data
  })
}
